package com.smec.moblie.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.smec.moblie.R;
import com.smec.moblie.bean.MaintenanceDetailBean;
import com.smec.moblie.crash.ExitAppUtils;

/**
 * 客户信息
 * <p/>
 * Created by sunyubo on 15/12/22.
 */
public class CustomerInfoActivity extends BaseActivity {
    /**
     * 客户名称
     **/
    private TextView textview_customer_name;
    /**
     * 客户地址
     **/
    private TextView textview_address;
    /**
     * 邮编
     **/
    private TextView textview_zipcode;
    /**
     * 电话1
     **/
    private TextView textview_tel1_no;
    /**
     * 电话2
     **/
    private TextView textview_tel2_no;
    /**
     * 电话3
     **/
    private TextView textview_tel3_no;
    /**
     * 联系人
     **/
    private TextView textview_contact_person;
    /**
     * 保养合同短名
     **/
    private TextView textview_mnt_contract_shortname;
    /**
     * 经度
     **/
    private TextView textview_longitude;
    /**
     * 纬度
     **/
    private TextView textview_latitude;
    /**
     * 手机编号
     **/
    private TextView textview_mobile_no;
    /** 返回按钮 **/
    private ImageView imageview_back;

    private RelativeLayout rl_title;


    @Override
    protected void setContentView() {
        setContentView(R.layout.remes_act_customerinfo);
    }

    @Override
    protected void initView() {
        ExitAppUtils.getInstance().addActivity(this);

        rl_title = (RelativeLayout)findViewById(R.id.rl_title);
//        PublicControl.setMargins(rl_title, 0, getStatusBarHeight(CustomerInfoActivity.this), 0, 0);

        textview_customer_name = (TextView) findViewById(R.id.textview_customer_name);
        textview_address = (TextView) findViewById(R.id.textview_address);
        textview_zipcode = (TextView) findViewById(R.id.textview_zipcode);
        textview_tel1_no = (TextView) findViewById(R.id.textview_tel1_no);
        textview_tel2_no = (TextView) findViewById(R.id.textview_tel2_no);
        textview_tel3_no = (TextView) findViewById(R.id.textview_tel3_no);
        textview_contact_person = (TextView) findViewById(R.id.textview_contact_person);
        textview_mnt_contract_shortname = (TextView) findViewById(R.id.textview_mnt_contract_shortname);
        textview_longitude = (TextView) findViewById(R.id.textview_longitude);
        textview_latitude = (TextView) findViewById(R.id.textview_latitude);
        textview_mobile_no = (TextView) findViewById(R.id.textview_mobile_no);
        imageview_back = (ImageView) findViewById(R.id.imageview_back);
        imageview_back.setOnClickListener(this);
    }

    @Override
    protected void getData() {

        MaintenanceDetailBean maintenanceDetailBean = (MaintenanceDetailBean) getIntent().getSerializableExtra("maintenanceDetail");

        textview_customer_name.setText(maintenanceDetailBean.getCUSTOMER_NAME());
        textview_address.setText(maintenanceDetailBean.getADDRESS());
        textview_zipcode.setText(maintenanceDetailBean.getZIPCODE());
        textview_tel1_no.setText(maintenanceDetailBean.getTEL1_NO());
        textview_tel2_no.setText(maintenanceDetailBean.getTEL2_NO());
        textview_tel3_no.setText(maintenanceDetailBean.getTEL3_NO());
        textview_contact_person.setText(maintenanceDetailBean.getCONTACT_PERSON());
        textview_mnt_contract_shortname.setText(maintenanceDetailBean.getMNT_CONTRACT_SHORTNAME());
        textview_longitude.setText(maintenanceDetailBean.getLONGITUDE());
        textview_latitude.setText(maintenanceDetailBean.getLATITUDE());
        textview_mobile_no.setText(maintenanceDetailBean.getMOBILE_NO());
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.imageview_back:
                CustomerInfoActivity.this.finish();
                break;
            default:
                break;
        }
    }
}
